<?php
include_once 'controller/default.php';
include_once 'connection/connection_database.php';

class script {

    function Insert($script) {
        $sql = "INSERT INTO script(script_code)"; 
        $sql .= "VALUES('{$script["script_code"]}')";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function Update($script) {
//        var_export($script);die;
        $sql = "UPDATE script SET script_code='{$script["script_code"]}' WHERE script_id='{$script["id"]}'";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }

    function FillAll() {
        $sql = "SELECT * FROM script";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
}

?>
